
#include "Reactorserver.hpp"
#include "Calculator.hpp"

std::string Onmessge(std::shared_ptr<Connection> con_ptr)
{
    static Calculator cal;
    std::string& inbuffer = con_ptr->Get_Inbuffer();  

    std::string ret = cal(inbuffer);  // 对请求进行处理 , 返回一个序列化后的字符串
    return ret;
}


int main(int argc , char* argv[])
{
    if(argc != 2)
    {
        exit(1);
    }

    uint16_t port = std::stoi(argv[1]);
    std::shared_ptr<Rserver> svr(new Rserver(port , Onmessge));
    svr->Init();
    svr->Run();

    return 0;
}